<!DOCTYPE html>
<html> 
{include file="head.html"}
<body>
<div class="fullscreen">
  <div class="scroll_content">
    <div class="topfixed">
      <div class="t_left"><a href="/index.php?m=koudai"><i class="back"></i></a></div>
      <div class="t_main">确认订单</div>
    </div>
    <div class="paddingheight"></div>
    <form method="post" id="order-confirm-form" action="/index.php?m=koudai_order&a=order">
<input type="hidden" name="back_url" value="{$back_url}" />
<input type="hidden" name="shopid" value="{$koudai.id}">
    <div class="comblock">
       	<h3>
		收货地址&nbsp; <a  href="/index.php?m=user_address&a=add" class="small right" id="add_address">新增地址</a>     
 		</h3>
 	<div class="skyline"></div>
    <ul class=" data-list "id="address_list">
     
    {foreach item=c key=k from=$address}
    
    <li class="item"> <input type="radio" class="user_address_id" name="user_address_id" {if $k eq 0} checked{/if} value="{$c.id}"> 地址：{$dist_list[$c.province_id]} {$dist_list[$c.city_id]} {$dist_list[$c.town_id]} {$c.address}  姓名：{$c.truename} 手机：{$c.telephone}
    </li>
        {/foreach}
    </ul>
    </div>
  

<ul class="cart_new_list clearfix">
        <li>
            <div class="d_name">口袋订单</div>
            {foreach item=c from=$koudai_orderCart}
            <input type="hidden" name="cart_id[]" value="{$c.id}" />
            <div class="list clearfix">
                <div class="cart_pic">
                    <a href=""><img src="{$c.imgurl|images_site}.100x100.jpg" class="img"></a>
                </div>
                <div class="cart_content">
                    <div class="tit">{$c.title}</div>
                    <div class="info">
                        <p class="fl">
                            <span class="num">￥{$c.price}&nbsp;&nbsp;&nbsp;&nbsp;{$c.amount}件</span>
                        </p>

                        <p class="fr">
                            <b class="red">￥{math equation="x*y" x="$c.price" y="$c.amount"}</b>
                        </p>
                    </div>

                </div>
            </div>
            {/foreach}
            <div class="cart_total">共{$total_num}件，
                合计：￥<b class="red">{$total_money}</b>
            {if $express_money>0}(含配送费：￥<b class="red">{$express_money}</b>元){/if}
            </div>
        </li>

    </ul>



<div class="comblock">
	 
     <dl class="cart_change_dl special clearfix">
            <dt>选择付款方式：</dt>
             {foreach item=p key=k name=paylist from=$pay_type_list}
              
           {if $smarty.foreach.paylist.first}
           <input type="hidden" name="pay_type" value="{$k}" id="paytype">
           {/if}
            <dd tid="paytype" class="{if $k eq 'moneypay' && !$moneypay}disabled{/if}{if $smarty.foreach.paylist.first}cur{/if}"  v="{$k}">
                <span class="select"></span>{$p}
            </dd>
            {/foreach}
            
             

        </dl>
  <div class="comblock" id="fenqibox" style="display:none">
  		<div>个人可用额度：{$youka.money}</div>
        <div> 寝室可用额度:{$ssyouka.money|intval}</div>
        <dl class="cart_change_dl clearfix">
            <dt>选择口袋类型：</dt>
             
            <dd tid="fenqi" class="cur" v="1">
                <span class="select"></span>个人口袋 <span class="txt">订单金额不超过50元 </span>
            </dd>
             
            <dd tid="fenqi" v="2">
                <span class="select"></span>寝室口袋 <span class="txt">室友也可参与结算</span>
            </dd>

        </dl>

    </div>
    <div>优惠劵：
    <select id="coupon_id" name="coupon_id">
      <option>暂无优惠券</option>
    </select>
  </div>
  <div class="cart_change_notice">
    <textarea class="area"  name="comment" placeholder="可填写您对口味以及配送时间的要求等"></textarea>
  </div>
</div>



<button  id="order-confirm-submit" type="button" class="cart_change_btn">确认购买</button>
 
</form>
 <script>

$(document).on("click",".cart_change_dl dd",function(e) {
	if($(this).hasClass("disabled")) return false;
	 
		$("#paytype").val($(this).attr("v"));
    $(this).addClass("cur").siblings().removeClass("cur");
});
</script>
<script language="javascript">
var submit_click=false;
$(document).ready(function(){
	
	$.get("/index.php?m=coupon&a=uselist&money={$total_money}&type=koudai&ajax=1",function(data){
		if(data.error==0){
			var html='<option value="0">请选择</option>';
			for(var i=0;i<data.data.length;i++){
				html=html+'<option value="'+data.data[i].id+'">'+data.data[i].title+'</option>';
			}
			$("#coupon_id").empty().append(html);
		}
	},"json")
	
	$(document).on("click","#order-confirm-submit",function(){
		if(submit_click==true){
			return false;
			setTimeout(function(){
				submit_click=false;
			},2000);
		}
		skyToast("正在处理订单..");
		$.post("/index.php?m=koudai_order&a=order&ajax=1",$("#order-confirm-form").serialize(),function(data){
			if(data.error==0){
				skyToast('订单提交成功');
				window.location=data.url;
			}else{
				skyToast(data.message)
			}
		},"json");
	});
	
	 
	 
});
	
</script>
{include file="footer.html"}  
</body>
</html>